As microprocessors have evolved over time, different operating modes have been developed. Earlier microprocessors, such as the Intel 8088, Intel 8086, Intel 80188, and Intel 80186, operate only in real mode. In real mode, addresses are generated by shifting the value of a 16-bit segment register by four bits, and then adding a 16-bit address offset. Later microprocessors, beginning with the Intel 80286, add a second operating mode, referred to as protected mode. In protected mode, the segment registers do not contain real (i.e. physical) addresses. Rather, each segment register contains an index into a table of segment descriptors. A segment descriptor contains the start address (i.e. base address) of the segment, along with memory protection information, such as an offset limit, and read and write permission bits. An address is generated by adding an offset to the start address of the segment. Note that a segment start address in the 80286 is a 24-bit base address, while a segment start address in the 80386 is a 32-bit base address. Later microprocessors, such as the 80286 and 80386, operate in real mode when first powered up. Protected mode may be enabled by software. In addition, the 80286, 80386, and later microprocessors are designed to be upwardly compatible with the addressing scheme of earlier microprocessors.
Various features of the 80386 support multitasking. The 80386 includes memory paging hardware, which allows the implementation of a virtual memory system. The 80386's memory management capabilities may be used to isolate tasks from each other, and to prevent one task from corrupting another task's data or code areas. Note that a task is a program or group of programs which uses a particular set of resources (e.g., address space, registers, etc.). The 80386 further includes privilege level protection, which is used to selectively protect various portions of the operating system and other software (e.g., device drivers) from application programs. Privilege level protection may also be used to protect some parts of the operating system from other parts of the operating system, or for protecting a task from some of its own errors.
The privilege level protection of the 80386 is based on a privilege hierarchy. Privilege levels are typically referred to as rings, with Ring 0 being the most privileged level, and Ring 3 being the least privileged level. A program assigned to a particular privilege level can only access data and other programs which are assigned to the same or a higher privilege level. Thus, a Ring 2 program can call other Ring 2 programs and Ring 3 programs, but can not make a direct call to a Ring 1 or Ring 0 program. One typical manner for assigning privilege in a computer system is to assign the operating system kernel to Ring 0, other operating system services to Ring 1, original equipment manufacturers (OEMs) software (e.g., device drivers) to Ring 2, and user applications to Ring 3.
Whenever an application program executes an interrupt or an I/O instruction, the processor generates an exception which forces an execution mode switch. Usually, this is a switch from Ring 3 to Ring 0 in order to allow the system to handle the exception. Note that I/O instructions do not always generate an exception. Exceptions occur if the I/O privilege level of an application does not allow it to access ports normally and/or the I/O permission bit map does not grant access to the port. Also, many newer application programs do not use interrupts to request system services. However, a large number of legacy DOS programs exist and are used extensively in today's information handling systems. The IBM Personal Computer, and other early personal computers (PCs), utilized the Intel 8088 microprocessor. The primary operating system for early PCs was the Disk Operating System (DOS). A large amount of software is still in use that was originally written to operate in a DOS environment on an 8088-based PC.
Due to the large amount of execution state information that must be saved during a ring transition, exception handling for these instructions requires a large number of clock cycles. Consequently, it would be desirable to have a system and method for eliminating unnecessary ring transitions in an information handling system, executing in protected mode. It would also be desirable to handle software interrupts and exceptions as quickly as possible.